package huawei;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 文本统计分析
 */
public class Q110 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        StringBuilder sb = new StringBuilder();

        while (sc.hasNext()) {
            sb.append(sc.nextLine()).append('\n');
        }

        // 先解决掉转意字符
        List<Integer> zhuanyi = new ArrayList<>();
        for (int i = 0; i < sb.length(); i++) {
            if (sb.charAt(i) == '\\') {
                zhuanyi.add(i);
            }
        }

        // 解决掉多个转意字符的情况
        for (int i = 0; i < zhuanyi.size(); i++) {
            if (i + 1 < zhuanyi.size() && zhuanyi.get(i) + 1 == zhuanyi.get(i + 1)) {
                sb.replace(i, i + 2, "ZZ");
                i += 1;
            }
        }

        boolean inString1 = false; // 是否在字符串中
        boolean inString2 = false; // 是否在字符串中
        boolean inZhuShi = false; // 是否在注释中
        for (int i = 0; i < sb.length(); i++) {
            // 判断是否在字符串中
            if (sb.charAt(i) == '"' && (i == 0 || sb.charAt(i - 1) != '\\')) {
                inString1 = !inString1;
                continue;
            }

            if (sb.charAt(i) == '\'' && (i == 0 || sb.charAt(i - 1) != '\\')) {
                inString2 = !inString2;
                continue;
            }

            if (sb.charAt(i) == '-' && i > 0 && sb.charAt(i - 1) == '-' && !inString1 && !inString2) {
                inZhuShi = true;
                continue;
            }

            if (sb.charAt(i) == '\n' && !inString1 && !inString2) {
                inZhuShi = false;
                continue;
            }

            if ((inZhuShi || inString1 || inString2) && sb.charAt(i) == ';') {
                sb.replace(i, i + 1, "E");
            }
        }

        String[] strings = sb.toString().split(";");
        int count = 0;

        for (String s : strings) {
            if (!s.trim().isEmpty()) {
                count++;
            }
            System.out.println(s);
        }
        System.out.println(count);
    }
}
